-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix xref
description of shapes
#6194
Conversation
src/components/shapes/attributes.js
Outdated
'If the axis `type` is *log*, then you must take the', | ||
'log of your desired range.', | ||
'If the axis `type` is *date*, then you must convert', | ||
'the date to unix time in milliseconds.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh hmm, for shapes actually I don't think either of these is true, despite xref
containing this text for 6 years! See shapes.json
:
plotly.js/test/image/mocks/shapes.json
Lines 28 to 32 in b194d8c
{"layer":"below","x0":0.1,"x1":0.4,"y0":1.5,"y1":20,"opacity":0.5,"fillcolor":"#f00","line":{"width":8,"color":"#008","dash":"dashdot"}}, | |
{"path":"M0.5,3C0.5,9 0.9,9 0.9,3C0.9,1 0.5,1 0.5,3ZM0.6,4C0.6,5 0.66,5 0.66,4ZM0.74,4C0.74,5 0.8,5 0.8,4ZM0.6,3C0.63,2 0.77,2 0.8,3Z","fillcolor":"#fd2","line":{"width":1,"color":"black"}}, | |
{"layer":"below","xref":"x2","yref":"y2","type":"circle","x0":"2000-01-01 02","x1":"2000-01-01 08:30:33.456","y0":0.1,"y1":0.9,"fillcolor":"rgba(0,0,0,0.5)","line":{"color":"rgba(0,255,0,0.5)", "width":5}}, | |
{"xref":"x2","yref":"y2","path":"M2000-01-01_11:20:45.6,0.2Q2000-01-01_10:00,0.85 2000-01-01_21,0.8Q2000-01-01_22:20,0.15 2000-01-01_11:20:45.6,0.2Z","fillcolor":"rgb(151,73,58)"}, | |
{"xref":"x2","yref":"y2","type":"line","x0":"2000-01-01 11:00","x1":"2000-01-01 09:00","y0":"b","y1":"a","line":{"color":"#006","width":3}}, |
The first 2 have a log y axis, and the values are as data. The next two have date x axis, and the values are date strings (with an underscore between date and time for path
shapes)
But it is true for annotations on log
axes only that you need to take the log of the desired position. See annotations_autorange.json
where y: 2
anchors to data value 100:
plotly.js/test/image/mocks/annotations-autorange.json
Lines 72 to 76 in b194d8c
{ | |
"xref":"x2","yref":"y2","text":"From left","y":2,"ax":-17,"ay":0,"x":"2001-01-01", | |
"xanchor": "right", "yanchor": "top", "textangle": 35, "bordercolor": "#444", | |
"xshift": 10 | |
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃
shapes.yref
similar to shapes.xref
xref
description of shapes
@plotly/plotly_js